package spikes.sideFrame;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JComponent;

@SuppressWarnings("serial")
public class NarwhalSideButton extends JComponent implements MouseListener {
	
	private NarwhalFrame frame;
	private boolean active;
	private final Color BACKGROUND_ACTIVE = Color.LIGHT_GRAY;
	private final Color BACKGROUND_NO_ACTIVE = Color.DARK_GRAY;
	private final Color TEXT_COLOR = Color.WHITE;
	private int index;
	
	
	public NarwhalSideButton(NarwhalFrame frame,int index) {
		this.frame = frame;
		addMouseListener(this);
	}
	
	
	public void setActive(boolean a) {
		active = a;
		repaint();
	}
	
	@Override
	public void paint(Graphics g) {
		int width = getBounds().width;
		int height = getBounds().height;
		
		Color bg = BACKGROUND_NO_ACTIVE;
		if (active)
			bg = BACKGROUND_ACTIVE;
		g.setColor(bg);
		g.fillRect(0,0,width,height);
	}


	@Override
	public void mouseClicked(MouseEvent e) {
		frame.setActive(this);
	}


	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
	
}

